<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">    
    <form class="well form-inline margin-top-20" method="post" action="{:url('Statis/store')}">
        品牌:
        <select class="form-control" name="brandid" style="width: 140px;">
          <option value='0'>全部</option>
          <foreach name="brand" item="v" key='k'>
          <option value='{$v.id}'>{$v.name}</option>
          </foreach>
        </select> &nbsp;&nbsp;
          店铺名称：
           <input type="text"  class="form-control" name="store_name"  value="{:input('request.store_name')}">
        省:
        <select class="form-control" name="provinceid" id='provinces' >
            <option value="0" >请选择</option>
            <foreach name="provinces" item="vo">
                <if condition="$vo.provinceid eq $info.provinceid">
                    <option selected value="{$vo.provinceid}" >{$vo.province}</option>
                    <else/>
                    <option value="{$vo.provinceid}" >{$vo.province}</option>
                </if>
            </foreach>
        </select>
        市：
        <select class="form-control" name="cityid" id='city' >
            <option value="0" >请选择</option>
            <foreach name="cities" item="vo">
                <if condition="$vo.cityid eq $info.cityid">
                    <option selected value="{$vo.cityid}">{$vo.city}</option>
                    <else/>
                    <option value="{$vo.cityid}" >{$vo.city}</option>
                </if>
            </foreach>
        </select>
        县：
        <select class="form-control" name="areaid" id='areas'>
            <option value="0" >请选择</option>
            <foreach name="areas" item="vo">
                <if condition="$vo.areaid eq $info.areasid">
                    <option selected value="{$vo.areaid}" >{$vo.area}</option>
                    <else/>
                    <option value="{$vo.areaid}" >{$vo.area}</option>
                </if>
            </foreach>
        </select>
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('Statis/store')}">清空</a>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>                
                <th>编号</th>                
                <th>店名</th>
                <th>地址</th>
                <th>品牌</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <foreach name="store_list" item="vo" key='k'>
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.store_name}</td>
                    <td>{$vo.province}->{$vo.city}->{$vo.area}</td>
                    <td>{:getbrand($vo['brandid'],'name')}</td>
                    <if condition="$vo.status eq -3">
                        <td style="color: red">{$vo.status|get_kg}</td>
                    <else/>
                        <td>{$vo.status|get_kg}</td>
                    </if>
                    <td>
                    <a href="javascript:parent.openIframeLayer('{:url('Statis/slist',array('storeid'=>$vo['id']))}','店铺营业额统计',{});">店铺营业额统计</a>
                    <a href="javascript:parent.openIframeLayer('{:url('Single/slist',array('storeid'=>$vo['id']))}','商品汇总',{});">商品汇总</a>
                    <a href="javascript:parent.openIframeLayer('{:url('order_admin/index',array('storeid'=>$vo['id']))}','订单明细',{});">订单明细</a>
                    </td>
                </tr>
            </foreach>
        </table>
        <ul class="pagination">{$page}</ul>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
    $('#provinces').change(function () {
        var provinces=$('#provinces option:selected').val();
        $.post("{:url('store/city')}",{provinces:provinces},function (date) {
            var con="";
            $.each(date.msg,function(k,v){
                con +='<option value='+v.cityid+' >'+v.city+'</option>'
                $('#city').html(con);
            })
        })
    })
    $('#city').change(function(){
        var city=$('#city option:selected').val();
        if(city==0)
        {
            alert("请选择市级单位");
            return false;
        }
        $.post("{:url('store/areas')}",{city:city},function (date) {
            var con="";
            $.each(date.msg,function(k,v){
                con +='<option value='+v.areaid+' >'+v.area+'</option>'
                $('#areas').html(con);
            })
        })
    })
</script>